#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QThread>
#include <QTimer>
#include <parameter.hpp>
#include <record.hpp>
#include <engine.h>
#include <QHash>
#include <QListWidgetItem>
#include <aboutpage.h>

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    ~Widget();
    Parameter* getParameter();

signals:
    void reset();
    void nextStep();
    void prepare(bool);

private slots:
    void timeout();
    void prepared(bool);
    void finished(bool ok);
    void lock_input_boxes(bool);
    void stepFinished(bool ok, int curStep, QVector<double> data);

    void on_btn_add_clicked();
    void on_btn_start_clicked();
    void on_btn_reset_clicked();
    void on_btn_pause_clicked();
    void on_btn_clear_clicked();
    void on_btn_delete_clicked();
    void on_btn_export_clicked();
    void on_btn_prepare_clicked(bool checked);
    void on_listWidget_itemClicked(QListWidgetItem *item);
    void on_combo_resampling_mode_currentIndexChanged(int index);

    void on_btn_pause_2_clicked();

private:
    Ui::Widget *ui;
    AboutPage * aboutPage;
    Engine *m_engine;
    QTimer  m_timer;
    Parameter m_parm;
    QThread  m_thread;
    Record m_cachedRecord;
    QHash<QString,Record> m_data;
};

#endif // WIDGET_H
